    /*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package pe.edu.upc.dew.sisrest.controller;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import pe.edu.upc.dew.sisrest.model.Ingrediente;
import pe.edu.upc.dew.sisrest.service.IngredienteManager;

/**
 *
 * @author Aldo
 */

@Controller
public class IngredienteController {

    IngredienteManager ingredienteManager;

    @Autowired
    public IngredienteController(IngredienteManager oIngredienteManager){
        this.ingredienteManager = oIngredienteManager;
    }

    @RequestMapping("/adm_ingredientes.htm")
    public void adm_ingredientes(Model model, @ModelAttribute("Ingrediente") Ingrediente ingrediente) {
		List<Ingrediente> ingredientes = ingredienteManager.obtenerIngredientes();
                model.addAttribute("ingredientes", ingredientes);
                model.addAttribute("ingrediente", ingrediente);
    }
}
